home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2005 October
/
PCWOCT05.iso
/
Software
/
FromTheMag
/
Syn Text Editor 2.1.0.46
/
synsetup-2.1.0.46.exe
/
{app}
/
scripts
/
sfu.vbs
< prev
next >
Wrap
Text File
|
2003-08-13
|
5KB
|
182 lines
' Caption: Upload to SourceForge|
' Hint: Upload files to SourceForge using SSH|
' Icon: sfu.ico|
'
' syn
' Copyright (C) 2000-2003, Ascher Stefan. All rights reserved.
' stievie@utanet.at, http://web.utanet.at/ascherst/
'
' The contents of this file are subject to the Mozilla Public License
' Version 1.1 (the "License"); you may not use this file except in compliance
' with the License. You may obtain a copy of the License at
' http://www.mozilla.org/MPL/
'
' Software distributed under the License is distributed on an "AS IS" basis,
' WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
' the specific language governing rights and limitations under the License.
'
' The Original Code is sfu.vbs, released Wed, 24 Jul 2002 21:18:45 UTC.
'
' The Initial Developer of the Original Code is Ascher Stefan.
' Portions created by Ascher Stefan are Copyright (C) 2000-2003 Ascher Stefan.
' All Rights Reserved.
'
' Contributor(s): .
'
' Alternatively, the contents of this file may be used under the terms of the
' GNU General Public License Version 2 or later (the "GPL"), in which case
' the provisions of the GPL are applicable instead of those above.
' If you wish to allow use of your version of this file only under the terms
' of the GPL and not to allow others to use your version of this file
' under the MPL, indicate your decision by deleting the provisions above and
' replace them with the notice and other provisions required by the GPL.
' If you do not delete the provisions above, a recipient may use your version
' of this file under either the MPL or the GPL.
'
' You may retrieve the latest version of this file at the syn home page,
' located at http://syn.sourceforge.net/
'
' $Id: sfu.vbs,v 1.10.2.5 2003/08/13 00:38:45 neum Exp $
'
' ScriptEngine=VBScript
option explicit
'#include <consts>
'#include <cmnfunc>
' Modify this three constants
const user = "stievie"
const docsdir = "/home/groups/s/sy/syn/htdocs/"
const server = "@syn.sourceforge.net:"
dim list
dim uploadbtn
dim cdir
sub AddFilesClick(Sender)
dim i, j
with Create("TOpenDialog", Self)
.Title = "Select Files"
.Filter = "All Files (*.*)|*.*|Web Files (*.htm,*.html,*.css,*.js,*.pl,*.cgi,*.php,*.txt)|*.htm;*.html;*.css;*.js;*.pl;*.cgi;*.php;*.txt|" & _
"Pictures (*.png,*.jpg,*.gif)|*.png;*.jpg;*.gif"
.Options = .Options & ",ofAllowMultiSelect"
if DirExists(cdir) then
.InitialDir = cdir
end if
if .Execute then
for j = 0 to .FilesCount - 1
i = list.Items.Add(.Files(j))
list.Checked(i) = true
next
end if
.Free
end with
uploadbtn.Enabled = list.Items.Count > 0
end sub
sub Main(FileName)
dim form
if Documents.Count > 0 then
cdir = ExtractFilePath(ActiveDocument.FileName)
if not CheckSave then
exit sub
end if
end if
form = Create("TForm", Self)
with form
.Caption = "Upload Files to SourceForge"
.Position = "poOwnerFormCenter"
.BorderStyle = "bsDialog"
.Height = 280
.Width = 350
end with
list = Create("TCheckListBox", Self)
with list
.Parent = form
.Left = 5
.Top = 20
.Height = form.ClientHeight - 100
.Width = form.ClientWidth - 10
dim i, j
for i = 0 to Documents.Count - 1
if Documents(i).FileName <> "" then
j = .Items.Add(Documents(i).FileName)
.Checked(j) = true
end if
next
end with
with Create("TLabel", Self)
.Parent = form
.Caption = "&Select the files to upload:"
.Top = 5
.Left = 5
.FocusControl = list
end with
dim subdir
subdir = Create("TEdit", Self)
with subdir
.Parent = form
.Left = 5
.Top = list.Top + list.Height + 20
.Width = form.ClientWidth - 10
end with
with Create("TLabel", Self)
.Parent = form
.Caption = "&Sub Directory (must exist on the Server):"
.Top = list.Top + list.Height + 5
.Left = 5
.FocusControl = subdir
end with
uploadbtn = Create("TButton", Self)
with uploadbtn
.Parent = form
.Caption = "Upload"
.Default = true
.Left = form.ClientWidth - (.Width * 2) - 10
.Top = form.ClientHeight - .Height - 5
.ModalResult = mrOK
.Hint = "Upload selected files"
.Enabled = list.Items.Count > 0
end with
with Create("TButton", Self)
.Parent = form
.Caption = "Cancel"
.Cancel = true
.Left = form.ClientWidth - (.Width) - 5
.Top = form.ClientHeight - .Height - 5
.ModalResult = mrCancel
end with
with Create("TButton", Self)
.Parent = form
.Caption = "&Add File(s)..."
.Left = 5
.Top = form.ClientHeight - .Height - 5
.OnClick = "AddFilesClick"
end with
if form.ShowModal = mrOK then
dim files
for i = 0 to list.Items.Count - 1
if list.Checked(i) then
files = files & AddQuotesUnless(ExtractFileName(list.Items(i))) & " "
end if
next
dim pdir
if files <> "" then
pdir = CurDir
CurDir = cdir
if subdir.Text <> "" then
docsdir = docsdir & AddSlash(subdir.Text)
end if
' not very exhaustive the documentation to this scp program ;-).
Execute "scp " & files & user & server & docsdir, _
1, true ' Show the window for the password
CurDir = pdir
end if
end if
end sub